
Page({

  /**
   * 页面的初始数据
   */
  data: {
    zh: '',
    schema:[],
    formData:{
      'indicator-dots': false,
      'indicator-color': 'rgba(0, 0, 0, .3)',
      'indicator-active-color': '#000000',
      autoplay: false,
      current: 0,
      interval: 5000,
      duration: 500,
      circular: false,
      vertical: false,
      'display-multiple-items': 1,
      'previous-margin': '0px',
      'next-margin': '0px',
      'easing-function': 'default',
      'direction': 'all',
      'snap-to-edge': false,
      'layout-type': 'normal',
      'transformer-type': 'scaleAndFade',
      'indicator-type': 'normal',
      'indicator-margin': 10,
      'indicator-spacing': 4,
      'indicator-radius': 4,
      'indicator-width': 8,
      'indicator-height': 8,
      'indicator-alignment': 'auto',
      'indicator-offset': '[0, 0]',
      'scroll-with-animation': true,
      'cache-extent': 0,
    },
    title: '',
    result: '',
    remark: '',
    webUrl: '',
    apiName: '',
    background: ['demo-text-1', 'demo-text-2', 'demo-text-3', 'demo-text-4']
  },
  onUnload() {
  },
  onLoad(options) {
    console.log('options', options)
    wx.setNavigationBarTitle({
      title: options.title,
    })
    
    this.setData({
      title: options.title,
      zh:options.zh,
      remark: options.remark,
      webUrl: options.webUrl
    })
    this.setData({
      schema: [
        {
          label:'是否显示面板指示点',
          prop: 'indicator-dots',
          type:'switch'
        },
        {
          label:'指示点颜色',
          prop: 'indicator-color',
          type:'text'
        },
        {
          label:'当前选中的指示点颜色',
          prop: 'indicator-active-color',
          type:'text'
        },
        {
          label:'是否自动切换',
          prop: 'autoplay',
          type:'switch'
        },
        {
          label:'当前所在滑块的 index',
          prop: 'current',
          type:'number'
        },
        {
          label:'自动切换时间间隔',
          prop: 'interval',
          type:'number'
        },
        {
          label:'滑动动画时长',
          prop: 'duration',
          type:'number'
        },
        {
          label:'是否采用衔接滑动',
          prop: 'circular',
          type:'switch'
        },
        {
          label:'滑动方向是否为纵向',
          prop: 'vertical',
          type:'switch'
        },
        {
          label:'同时显示的滑块数量',
          prop: 'display-multiple-items',
          type:'number'
        },
        {
          label:'前边距，可用于露出前一项的一小部分，接受 px 和 rpx 值',
          prop: 'previous-margin',
          type:'text'
        },
        {
          label:'后边距，可用于露出后一项的一小部分，接受 px 和 rpx 值。skyline 于 3.5.1 版本支持',
          prop: 'next-margin',
          type:'text'
        },
        {
          label:'指定 swiper 切换缓动动画类型',
          prop: 'easing-function',
          type:'picker',
          labelOptions:['默认缓动函数', '线性动画', '缓入动画', '缓出动画', '缓入缓出动画'],
          valueOptions:['default', 'linear', 'easeInCubic', 'easeOutCubic', 'easeInOutCubic'],
        },
        {
          label:'指定 swiper 滑动方向',
          prop: 'direction',
          type:'picker',
          labelOptions:['默认', '如 vertical 为 true 时，允许用户下滑（swiper 内容向上滚动），为 false 时，允许用户右滑（swiper 内容向左滚动）', '如 vertical 为 true 时，允许用户上滑（swiper 内容向下滚动），为 false 时，允许用户左滑（swiper 内容向右滚动）'],
          valueOptions:['all', 'positive', 'negative'],
        },
        {
          label:'渲染模式',
          prop: 'layout-type',
          type:'picker',
          labelOptions:['默认方式', '左向堆叠', '右向堆叠', '滑动卡片', '过渡动画'],
          valueOptions:['normal', 'stackLeft', 'stackRight', 'tinder', 'transformer'],
        },
        {
          label:'layout-type 为 transformer 时指定动画类型',
          prop: 'transformer-type',
          type:'picker',
          labelOptions:['scaleAndFade', 'accordion', 'threeD', 'zoomIn', 'zoomOut', 'deepthPage'],
          valueOptions:['scaleAndFade', 'accordion', 'threeD', 'zoomIn', 'zoomOut', 'deepthPage'],
        },
        {
          label:'指示点动画类型',
          prop: 'indicator-type',
          type:'picker',
          labelOptions:['normal', 'worm', 'wormThin', 'wormUnderground', 'wormThinUnderground', 'expand', 'jump', 'jumpWithOffset', 'scroll', 'scrollFixedCenter', 'slide', 'slideUnderground', 'scale', 'swap', 'swapYRotation', 'color'],
          valueOptions:['normal', 'worm', 'wormThin', 'wormUnderground', 'wormThinUnderground', 'expand', 'jump', 'jumpWithOffset', 'scroll', 'scrollFixedCenter', 'slide', 'slideUnderground', 'scale', 'swap', 'swapYRotation', 'color'],
        },
        {
          label:'指示点四周边距',
          prop: 'indicator-margin',
          type:'number'
        },
        {
          label:'指示点间距',
          prop: 'indicator-spacing',
          type:'number'
        },
        {
          label:'指示点圆角大小',
          prop: 'indicator-radius',
          type:'number'
        },
        {
          label:'指示点宽度',
          prop: 'indicator-width',
          type:'number'
        },
        {
          label:'指示点高度',
          prop: 'indicator-height',
          type:'number'
        },
        {
          label:'指示点的相对位置',
          prop: 'indicator-alignment',
          type:'picker',
          labelOptions:['auto', '[10, 20, 10, 20]'],
          valueOptions:['auto', '[10, 20, 10, 20]'],
        },
        {
          label:'指示点位置的偏移量',
          prop: 'indicator-offset',
          type:'picker',
          labelOptions:['[0, 0]', '[10, 20]'],
          valueOptions:['[0, 0]', '[10, 20]'],
        },
        {
          label:'改变 current 时使用动画过渡',
          prop: 'scroll-with-animation',
          type:'switch'
        },
        {
          label:'缓存区域大小，值为 1 表示提前渲染上下各一屏区域（swiper 容器大小）',
          prop: 'cache-extent',
          type:'number'
        },
      ]
    })
  },
  getFormData(e) {
    console.log('formdata==', e.detail.formData);
    this.setData({
      formData: e.detail.formData
    })
  },
  coverImage(e) {
  },
})